/**************************************************************
 *   File:	Debug.h
 * Author:	Andrew Thorpe
 *  Brief:	Some usefull debug functions, stubbed in release
			builds
 **************************************************************/
#ifndef _FOSSIL_DEBUG_H
#define _FOSSIL_DEBUG_H

#include "FormatBuffer.h"
#include <stdlib.h>
using namespace Fossil;

//Make all asserts use our system
#if defined(assert)
# undef assert
# define assert(exp) ASSERT(exp)
#endif//defined(assert)

#if !defined(NDEBUG)
# define ASSERT(exp)		((void)( (exp) || (Alert("ASSERT FAIL:"#exp, __FILE__, __LINE__), 0) ))
#else
# define ASSERT(exp)
#endif//!defned(NDEBUG)

//Functions
#if !defined(NDEBUG)
//This Alert method is for debugging only, it deliberately doesn't exist in realease to prevent mis-use
void Alert(const char* msg, const char* file, int line);
#endif//!defned(NDEBUG)

#endif//_FOSSIL_DEBUG_H
